import time
import yaml
import yagmail,logging
# 工具类
def send_log():
#编写日志采集方法，生成的日志文件名含有时间戳，采集INFO级别及以上级别的日志
    str = time.strftime("%Y%m%d-%H%M%S")
    logging.basicConfig(filename=str+'baidu.log',filemode='w+',format='%(levelname)s-%(asctime)s-%(filename)s-%(message)s',level=logging.DEBUG)
# 封装发送邮件的方法
def send_email(filename):
    send=yagmail.SMTP(user='1441688225@qq.com',password='subvcobnwlujggee',host='smtp.qq.com')
    str = time.strftime("%Y%m%d-%H%M%S")
    send.send(to='1441688225@qq.com',subject=str+'百度webui自动化测试报告',contents=filename)

# def yaml():
#     with open('yaml.yaml','r',encoding='utf8') as e:
#         return yaml.safe_load(e)